package org.linlinjava.litemall.db.vo.marketing_manager;

/**
 * @author houzb
 * @Description
 * @create 2021-08-28 17:44
 */
public enum DeductionRuleTypeEnum {

    PERCENT(0, "百分比"),
    FIX_AMOUNT(1, "固定抵扣金"),
    ;

    private int typeVal;
    private String typeDesc;

    public int getTypeVal() {
        return typeVal;
    }

    public void setTypeVal(int typeVal) {
        this.typeVal = typeVal;
    }

    public String getTypeDesc() {
        return typeDesc;
    }

    public void setTypeDesc(String typeDesc) {
        this.typeDesc = typeDesc;
    }

    DeductionRuleTypeEnum(int typeVal, String typeDesc) {
        this.typeVal = typeVal;
        this.typeDesc = typeDesc;
    }

    public static String getTypeDescByVal(int typeVal) {
        DeductionRuleTypeEnum[] enums = DeductionRuleTypeEnum.values();
        for(DeductionRuleTypeEnum e:enums) {
            if(typeVal == e.getTypeVal()) {
                return e.getTypeDesc();
            }
        }
        return "未知类型";
    }
}
